/**
 * 2017年5月1日
 */
package cn.edu.bjtu.entity.impl.api;

import java.io.InputStream;
import java.net.URI;
import java.util.Map;
import java.util.concurrent.locks.ReadWriteLock;

import org.apache.http.HttpEntity;

import com.fasterxml.jackson.databind.JsonNode;


/**
 * @author Alex
 *
 */
public class Word2VecDatasetQueryContext extends Word2VecBaseContext<JsonNode>{
	String uri =  "/query/dataset";
	
	public Word2VecDatasetQueryContext(ReadWriteLock lock) {
		super(lock);
	}
	
	@Override
	public Map<String, Object> getResultMapForRender() {
		return this.resultMap;
	}

	@Override
	public URI getURI() {
		return URI.create(uri);
	}
	private JsonNode jn;
	@Override
	protected void handleResponseInputStream(InputStream in, HttpEntity entity) throws Exception{
		jn = om.readTree(in);
		JsonNode node = jn.at("/fileInfo");
		String filesListStr = node.asText();
		this.msg = filesListStr;
		resultMap.put("tip", filesListStr);
	}

	@Override
	public JsonNode javaClassResult() {
		return jn;
	}


}
